const mongoose = require('mongoose');

const securityEventSchema = new mongoose.Schema({
  type: { type: String, enum: ['intrusion', 'fire', 'emergency', 'access'], required: true },
  level: { type: String, enum: ['low', 'medium', 'high', 'critical'], required: true },
  location: {
    building: String,
    floor: String,
    room: String,
    coordinates: { x: Number, y: Number, z: Number }
  },
  description: String,
  status: { type: String, enum: ['active', 'resolved', 'investigating'], default: 'active' },
  assignedTo: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
  resolvedAt: Date
}, { timestamps: true });

module.exports = mongoose.model('SecurityEvent', securityEventSchema);